package com.nd.test.controller;

import java.util.List;
import java.util.Date;

import model.po.CouponsCategory;
import com.nd.test.vo.CouponsCategoryVo;
import com.nd.test.repository.CouponsCategoryRepository;
import com.nd.test.service.CouponsCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**   
 * Create by apisdk 
 */
@RestController
@RequestMapping(value="/couponsCategory")
public class CouponsCategoryController {
	@Autowired
	private CouponsCategoryRepository couponsCategoryRepository;

	@Autowired
	private CouponsCategoryService couponsCategoryService;

	/**
	* @description create model
	* @return
	*/
	@RequestMapping(value= "", method = RequestMethod.POST)
	public CouponsCategoryVo createCouponsCategory(@RequestBody CouponsCategoryVo couponsCategoryVo) throws Exception {
		return couponsCategoryService.createCouponsCategory(couponsCategoryVo);
	}

	/**
	* @description get model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.GET)
	public CouponsCategoryVo getCouponsCategoryById(@PathVariable String id){
		return couponsCategoryService.getCouponsCategoryById(id);
	}

	/**
	* @description update model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.PUT)
	public CouponsCategoryVo updateCouponsCategoryById(@PathVariable String id,@RequestBody CouponsCategoryVo couponsCategoryVo){
		return couponsCategoryService.updateCouponsCategoryById(id,couponsCategoryVo);
	}

	/**
	* @description delete model through id
	* @return
	*/
	@RequestMapping(value= "/{id}", method = RequestMethod.DELETE)
	public void deleteCouponsCategoryById(@PathVariable String id){
		couponsCategoryService.deleteCouponsCategoryById(id);
		return;
	}

}
